package com.hq.shop13sms.config;

import com.hq.commons.constatns.RabbitMQConstatns;
import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitMQConfig {

    @Bean
    public TopicExchange sendCodeExchange(){
        return new TopicExchange(RabbitMQConstatns.SEND_MESSAGE_EXCHANGE,true,false);
    }

    @Bean
    public Queue smsQueue(){
        return new Queue(RabbitMQConstatns.SMS_QUEUE,true,false,false);
    }

    @Bean
    public Binding goodsEsQueueBindGoodsExchange(){
        return BindingBuilder.bind(smsQueue()).to(sendCodeExchange()).with("send.sms.*");
    }
}
